//author: create by SunJH
//时间: 2021/11/29 0029
//邮箱: 965989158@qq.com
//描述: sliver功能测试的控制器

import 'package:flutter/material.dart';
import 'package:get/get.dart';

class SliverController extends GetxController{
  final scrollController = ScrollController();
  var isLoadMore = false.obs;
  var loadMoreCount = 0;
  var datas = [0,1,2,3,4,5,6,7,8,9];

  @override
  void onInit() {
    super.onInit();
    scrollController.addListener(() {
      if(scrollController.position.pixels>scrollController.position.maxScrollExtent -20){
        if(isLoadMore.value == true)return;
          print("触发上拉加载更多");
          isLoadMore.value = true;
          Future.delayed(Duration(seconds: 3),(){
            loadMoreCount++;
            infos.add("新增数据:$loadMoreCount");
            isLoadMore.value = false;
          });
      }
    });
  }
  var topWeatherPath = "https://api-ks.qimingdaren.com/assets/weather/img/晴.gif".obs;
  var bannerItems = <String>[
    "http://img.haote.com/upload/20180918/2018091815372344164.jpg",
    "https://api-ks.qimingdaren.com/assets/weather/img/晴.gif",
    "http://img.haote.com/upload/20180918/2018091815372344164.jpg",
  ].obs;
  var infos = <String>[
    "1",
    "2",
    "3",

  ].obs;
}